<?php

namespace common\models\personnel;

use common\behaviors\MerchantBehavior;

/**
 * This is the model class for table "{{%oauth_client}}".
 *
 * @property string $id
 * @property string $title 标题
 * @property string $client_id
 * @property string $client_secret
 * @property string $redirect_uri 回调Url
 * @property string $remark 备注
 * @property string $group 组别
 * @property int $status 状态[-1:删除;0:禁用;1启用]
 * @property string $created_at 创建时间
 * @property string $updated_at 修改时间
 */
class Personnel extends \common\models\base\BaseModel
{


    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%personnel_personnel}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['name','portrait','sex','phone','address','position_id','grade','explain','rank','identity','patriarch_phone'], 'required'],
            [[ 'personnel_id','status', 'created_at', 'updated_at'], 'integer'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'personnel_id' => 'ID',
            'portrait'=>'头像',
            'name' => '姓名',
            'sex'=>'性别',
            'phone'=>'手机号码',
            'address'=>'详细地址',
            'integral'=>'积分',
            'position_id'=>'职位',
            'status' => '状态',
            'grade'=>'年级',
            'rank'=>'等级',
            'explain'=>'等级说明',
            'identity'=>'身份证号码',
            'patriarch_phone'=>'家长电话',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }
    public function getCate()
    {
        return $this->hasOne(Position::class, ['id' => 'position_id']);
    }
    public function getCates()
    {
        return $this->hasOne(Menuy::class, ['id' => 'grade']);
    }
}
